import request from '../utils/request';

// 验收节点管理相关API
export const acceptanceNodeApi = {
  // 根据项目ID查询验收节点列表
  getAcceptanceNodesByProject: (projectId) => {
    return request.get(`/api/acceptance-node/project/${projectId}`);
  },

  // 根据项目ID和状态查询验收节点
  getAcceptanceNodesByProjectAndStatus: (projectId, status) => {
    return request.get(`/api/acceptance-node/project/${projectId}/status/${status}`);
  },

  // 创建验收节点
  createAcceptanceNode: (data) => {
    return request.post('/api/acceptance-node', data);
  },

  // 更新验收节点状态
  updateAcceptanceNodeStatus: (id, status) => {
    return request.put(`/api/acceptance-node/${id}/status`, null, {
      params: { status }
    });
  },

  // 更新实际验收时间
  updateActualAcceptanceDate: (id, actualAcceptanceDate) => {
    return request.put(`/api/acceptance-node/${id}/actual-date`, null, {
      params: { actualAcceptanceDate }
    });
  },

  // 提交验收节点
  submitAcceptanceNode: (id) => {
    return request.post(`/api/acceptance-node/${id}/submit`);
  },

  // 审核验收节点
  reviewAcceptanceNode: (id, status, remark) => {
    return request.post(`/api/acceptance-node/${id}/review`, null, {
      params: { status, remark }
    });
  },

  // 完成验收节点
  completeAcceptanceNode: (id) => {
    return request.post(`/api/acceptance-node/${id}/complete`);
  },

  // 批量创建验收节点
  batchCreateAcceptanceNodes: (data) => {
    return request.post('/api/acceptance-node/batch', data);
  }
};
